<extend name="Base/common"/>
<block name="Content">
    <form class="am-form" action="{:U('Role/index')}" method="post">
        <div class="am-cf am-padding-top">
            <div class="am-fl am-cf">
                <i class="am-icon-file"></i>
                <strong class="am-text-primary am-text-lg">菜单配置</strong>
            </div>
            <div class="am-text-right am-padding-right">
                <a class="am-btn am-btn-success am-btn-xs" href="{:U('Menu/editAction')}">新增菜单</a>
            </div>
            <hr data-am-widget="divider" class="am-divider am-divider-default" />
        </div>
        <div class="am-g am-padding-left" style="width:99.5%">
            <div class="am-g am-padding-left">
                <div class="am-u-sm-2">
                    折叠
                </div>
                <div class="am-u-sm-10">
                    <div class="am-u-sm-2">
                        排序 
                    </div>
                    <div class="am-u-sm-6">
                        名称
                    </div>
                    <div class="am-u-sm-4">
                        操作
                    </div>
                </div>
                <hr data-am-widget="divider" style="" class="am-divider am-divider-default" />
            </div>
            <foreach name="__AUTH__" item="vo">
                <div class="am-g am-padding-left">
                    <div class="am-u-sm-2">
                        <a class="am-icon-plus-circle" name="menu1" title="{$vo.menu_id}"></a>
                    </div>
                    <div class="am-u-sm-10">
                        <div class="am-u-sm-2">
                            {$vo.sort_no}
                        </div>
                        <div class="am-u-sm-6">
                            {$vo.menu_name}
                        </div>
                        <div class="am-u-sm-4">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <a class="am-btn am-btn-default am-btn-xs am-text-secondary" href="{:U('Menu/editAction?menu_id='.$vo['menu_id'])}"><span class="am-icon-pencil-square-o"></span>编辑</a>
                                    <a class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only ajax-get confirm" href="{:U('Menu/del?menu_id='.$vo['menu_id'])}"><span class="am-icon-trash-o"></span>删除</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <hr data-am-widget="divider" style="" class="am-divider am-divider-default" />
                </div>
                <foreach name="vo['_child']" item="sub_menu">
                    <nav>
                        <div class="am-g  am-nav am-collapse am-padding-left" title="{$vo.menu_id}">
                            <div class="am-u-sm-2">
                                <a data-am-collapse="{target: 'div[name={$sub_menu.menu_id}]'}" class="am-icon-plus-circle" name="menu" title="{$vo.menu_id}"></a>
                            </div>
                            <div class="am-u-sm-10">
                                <div class="am-u-sm-2">
                                    |-------{$sub_menu.sort_no}
                                </div>
                                <div class="am-u-sm-6">
                                    |------- {$sub_menu.menu_name}
                                </div>
                                <div class="am-u-sm-4">
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a class="am-btn am-btn-default am-btn-xs am-text-secondary" href="{:U('Menu/editAction?menu_id='.$sub_menu['menu_id'])}"><span class="am-icon-pencil-square-o"></span>编辑</a>
                                            <a class="am-btn am-btn-default am-btn-xs am-text-danger ajax-get confirm" href="{:U('Menu/del?menu_id='.$sub_menu['menu_id'])}"><span class="am-icon-trash-o"></span>删除</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <hr data-am-widget="divider" style="" class="am-divider am-divider-default" />
                        </div>
                    </nav>
                    <foreach name="sub_menu['_child']" item="menuname">
                        <nav>
                            <div class="am-g  am-nav am-collapse am-padding-left" name="{$sub_menu.menu_id}" title="{$vo.menu_id}">
                                <div class="am-u-sm-2">
                                </div>
                                <div class="am-u-sm-10">
                                    <div class="am-u-sm-2">
                                        |-------|_____ {$menuname.sort_no}
                                    </div>
                                    <div class="am-u-sm-6">
                                        |-------|_____ {$menuname.menu_name}
                                    </div>
                                    <div class="am-u-sm-4">
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                <a class="am-btn am-btn-default am-btn-xs am-text-secondary" href="{:U('Menu/editAction?menu_id='.$menuname['menu_id'])}"><span class="am-icon-pencil-square-o"></span>编辑</a>
                                                <a class="am-btn am-btn-default am-btn-xs am-text-danger ajax-get confirm" href="{:U('Menu/del?menu_id='.$menuname['menu_id'])}"><span class="am-icon-trash-o"></span>删除</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </nav>
                    </foreach>
                </foreach>
            </foreach>
        </div>
    </form>
</block>
<block name="script">
    <script type="text/javascript">
        $(function(){
            //全部展开与折叠
            $("a[name=menu1]").click(function(){
            
                if ($(this).hasClass('am-icon-plus-circle')) {
                
                    $(this).removeClass("am-icon-plus-circle").addClass("am-icon-minus-circle");
                    $("a[title=" + this.title + "]").removeClass("am-icon-plus-circle").addClass("am-icon-minus-circle");
                    $("div[title=" + this.title + "]").collapse('open');
                  
                }
                else {
                    $(this).removeClass("am-icon-minus-circle").addClass("am-icon-plus-circle");
                    $("a[title=" + this.title + "]").removeClass("am-icon-minus-circle").addClass("am-icon-plus-circle");
                    $("div[title=" + this.title + "]").collapse('close');
					 
                }
                
                
            });
            //子展开与折叠
            $("a[name=menu]").click(function(){
            
            
                if ($(this).hasClass('am-icon-plus-circle')) {
                    $(this).removeClass("am-icon-plus-circle").addClass("am-icon-minus-circle");
                    
                }
                else {
                    $(this).removeClass("am-icon-minus-circle").addClass("am-icon-plus-circle");
                    
                }
                
                
            });
            
            
        })
    </script>
</block>
